<?php
class SurfingTaskFormDecorator extends ATaskFormDecorator{
    public function getFormHTML($params, $view) {
        return $this->task_form->getFormHTML($params, $view).$view->getCustomer_formbody_step2_surfing($params);
    }

    public function validate_form(&$param, &$scope, $manager) {
        $iserror = false;
        //VTIME
        if (empty($param['vtime'])) {
            $iserror = true;
            $manager->addErorrMessageForField("vtime", "Время не задано");
        } elseif (!in_array(intval($param['vtime']), array(30, 60, 120))) {
            $iserror = true;
            $manager->addErorrMessageForField("vtime", "Время указано неверно");
        }
        else
            $param['vtime'] = intval($param['vtime']);
        if ($iserror) {
            return array_merge(array(VALIDATION_FAILED), $this->task_form->validate_form($param, $scope, $manager));
        }
        return array_merge(array(VALIDATION_ACCEPTED), $this->task_form->validate_form($param, $scope, $manager));
    }

    public function submit_form($params, $scope, $manager) {
        $this->task_form->submit_form($params, $scope, $manager);      
    }
}

?>
